<% cache(content) do %>
  <%= content_tag :div, id: content.dom_id, data: {"content-id" => content.id}, class: [
      "essence_picture_editor",
      options[:dragable] ? "dragable_picture" : nil,
      options[:grouped] ? nil : "content_editor"
    ].compact.join(" ") do %>
    <% unless options[:grouped] %><%= content_label(content) %><% end %>
    <div class="picture_thumbnail">
      <span class="picture_tool delete">
        <% if options[:grouped] %>
          <%= link_to_confirm_dialog "", Alchemy.t(:confirm_to_delete_image),
            alchemy.admin_essence_picture_path(
              id: content,
              options: options
            ), {title: Alchemy.t(:delete_image)} %>
        <% else %>
          <%= link_to '', '#',
            onclick: "return Alchemy.removePicture('##{content.form_field_id(:picture_id)}');" %>
        <% end %>
      </span>
      <%- if content.ingredient -%>
        <div class="picture_handle" title="<%= Alchemy.t(:drag_to_sort) if options[:dragable] %>"></div>
      <%- end -%>
      <div class="picture_image">
        <div class="thumbnail_background<%= ' missing' if content.ingredient.nil? %>">
          <%- if content.ingredient -%>
          <%= essence_picture_thumbnail(content, options) %>
          <%= hidden_field_tag content.form_field_name(:picture_id), content.ingredient.id %>
          <% end %>
        </div>
      </div>
      <%- if content.essence.css_class.present? -%>
        <div class="essence_picture_css_class">
          <%= Alchemy.t("alchemy.essence_pictures.css_classes.#{content.essence.css_class}",
            default: content.essence.css_class.camelcase) %>
        </div>
      <%- end -%>
      <div class="edit_images_bottom">
        <%= render 'alchemy/essences/shared/essence_picture_tools', {
          content: content,
          options: options
        } %>
      </div>
    </div>
    <%= hidden_field_tag content.form_field_name(:link),
      content.essence.link %>
    <%= hidden_field_tag content.form_field_name(:link_title),
      content.essence.link_title %>
    <%= hidden_field_tag content.form_field_name(:link_class_name),
      content.essence.link_class_name %>
    <%= hidden_field_tag content.form_field_name(:link_target),
      content.essence.link_target %>
  <% end %>
<% end %>
